package com.qingcloud.base.config;

import com.qingcloud.base.passwordencode.Md5PasswordEncoder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;



/**
 * 密码加密配置类
 */
public class DefaultPasswordConfig {
	@Bean
	@ConditionalOnMissingBean
	public PasswordEncoder passwordEncoder() {
		PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
		return passwordEncoder;
	}

	@Bean
	@ConditionalOnMissingBean
	public Md5PasswordEncoder md5PasswordEncoder() {
		Md5PasswordEncoder passwordEncoder = new Md5PasswordEncoder();
		return passwordEncoder;
	}
}
